
(in-package :tutorial)

(defun get-all-triples-for-me ()
  (db.agraph.user::s0d (?s ?o ?p) (db.agraph.user::q- ?s ?o ?p))
  )

(publish :path "/home"
    :content-type "text/html"
    :function 
    #'(lambda (req ent)
         (with-http-response (req ent)
           (with-http-body (req ent)
             ; (let ( ( count 0))
               (html 
                  (:html (:head (:title "Home"))
                         (:body 
                          (:ul (:li "Theres no place like home...")
                               (:li "...and this is no place like home!"  )
                               )
                          :p :hr :p
                          (:ul 
                           (:li ((:a :href "list-all-milestones") "List All Milestones") :br)
                           (:li ((:a :href "list-all-triples") "List All Triples") :br)
                           (:li ((:a :href "list-all-actors") "List All Actors") :br)
                           (:li ((:a :href "enter-new-milestone") "Enter New Milestone") :br)
                           (:li ((:a :href "enter-new-actor") "Enter New Actor") :br)
                           
                               )
                         ); end body
                         )) ;end html
               ;  ) ; end let
             )))) 

(publish :path "/list-all-triples"
    :content-type "text/html"
    :function 
    #'(lambda (req ent)
         (with-http-response (req ent)
           (with-http-body (req ent)
             (let ( (the-triples (cons '("Subject" "Predicate" "Object") (get-all-triples-for-me) )))
               (html 
                  (:html (:head (:title "OMG Here are all the Triples!"))
                         (:body 
                          (:ul (:li "Pretty dry stuff, isn't it.")
                               (:li "Don't miss the pokemon"  )
                               (:li "Not in any particular order because this is by the internal indexing")
                               (:li "There are " (:princ-safe  (db.agraph.user::triple-count)) " triples in this repository")
                               (:li ((:a :href "home") "Home") :br)
                               )
                                    :p :hr :p
                          
                          
                          (make-table the-triples) :p :hr
                          
                         
                         ); end body
                         )) ;end html
               ) ; end let
             ))))



    
